package org.example;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.example.entity.User;
import org.example.mapper.UserMapper;
import org.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "用户控制器")
@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @Resource
    private UserMapper userMapper;

    @ApiOperation(value = "用户详情", notes = "用户详情")
    @RequestMapping("/userlist")
    public List<User> detail() {
        return userMapper.selectList(null);
    }

    @RequestMapping("/useronce")
    public User useronce() {
        return userService.find(2);
    }

}
